package chan.project.model.vo;

import cn.hutool.json.JSONUtil;
import chan.project.model.entity.TravelPlanThumb;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 旅行计划点赞视图
 *
 * @author <a href="https://github.com/kavansp">kavansp</a>
 *
 */
@Data
public class TravelPlanThumbVO implements Serializable {

    /**
     * 旅行计划id
     */
    private Long travelPlanId;

    /**
     * 创建用户Id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 封装类转对象
     *
     * @param travelPlanThumbVO
     * @return
     */
    public static TravelPlanThumb voToObj(TravelPlanThumbVO travelPlanThumbVO) {
        if (travelPlanThumbVO == null) {
            return null;
        }
        TravelPlanThumb travelPlanThumb = new TravelPlanThumb();
        BeanUtils.copyProperties(travelPlanThumbVO, travelPlanThumb);
        return travelPlanThumb;
    }

    /**
     * 对象转封装类
     *
     * @param travelPlanThumb
     * @return
     */
    public static TravelPlanThumbVO objToVo(TravelPlanThumb travelPlanThumb) {
        if (travelPlanThumb == null) {
            return null;
        }
        TravelPlanThumbVO travelPlanThumbVO = new TravelPlanThumbVO();
        BeanUtils.copyProperties(travelPlanThumb, travelPlanThumbVO);
        return travelPlanThumbVO;
    }
}
